<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery/jquery-3.0.0.min.js"></script>
	<script>
	//--每10秒触发ajax，访问服务器，获取未未读消息条数
	window.setInterval(ref, 10000);
	function ref(){
		//参数c为当前页面显示到了哪条记录，服务器只要发送这条记录之后的数据就可以了
		$.post("${pageContext.request.contextPath}//message/receive/unreadNum",id,function(unreadNUM){
			$("#unreadNumShow").text("消息__("+ unreadNUM +")__");
		});
	}
</script>
<body>	
    <div class="Head">
      <div id="navTopFather">
        <div id="navBadgeImg">
          <!-- <img src="main.jpeg" height=100%> -->
          <font size="18" color="gree">乐玩社团网</font>
        </div>
        <div id="navClassNameDiv">
          <div id=navClassName>
            <b>乐玩社团，带你玩转社团</b>
          </div>
          <img alt="dd" src="image/111.jpg">
        </div>

        <div id="navLogin">
          <div id="select_login">
			<c:if test="${sessionScope.user == null }">
				<a href="${pageContext.request.contextPath}/loginPage.do?redirect_url=/index.jsp">登录</a>
				&nbsp;&nbsp;&nbsp;
				<a href="registerPage.do">注册</a>
			</c:if>
			<c:if test="${sessionScope.user != null }">
				<a href="${pageContext.request.contextPath }/user/${user.userId }.do">${sessionScope.user.name }</a>
				&nbsp;&nbsp;&nbsp;
				<% Integer unReadMsgNumber=(Integer)request.getSession().getAttribute("unReadMsgNumber"); %>
				<c:if test="${unReadMsgNumber==null}">
					<a id="unreadNumShow" href="${pageContext.request.contextPath}/message/receive/list.do">消息</a>
				</c:if>
				<c:if test="${unReadMsgNumber!=null}">
					<a id="unreadNumShow" href="${pageContext.request.contextPath}/message/receive/list.do">消息(${unReadMsgNumber})</a>
				</c:if>
				&nbsp;&nbsp;&nbsp;
				<a href="${pageContext.request.contextPath}/loginOut.do">注销</a>
			</c:if>
          </div>
        </div>
      </div>
     </div>
</body>
</html>